package com.itheima.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

/**
 * ClassName: SpringConfig
 * Description:
 * Date: 2023/03/22 PM 10:55:18
 * <p>
 * project: springboot
 * package: com.itheima.config
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
// @Import({MyImportSelector.class})
// @Import(Mouse.class)
@ComponentScan("com.itheima.bean")
public class SpringConfig {

    // @Bean
    // // @ConditionalOnClass(name = "com.itheima.bean.Wolf")
    // // @ConditionalOnMissingClass("com.itheima.bean.Mouse")
    // @ConditionalOnBean(name = "jerry")
    // // @ConditionalOnMissingClass("com.itheima.bean.Dog")
    // // @ConditionalOnNotWebApplication
    // @ConditionalOnWebApplication
    // public Cat tom() {
    //     return new Cat();
    // }

    @Bean
    @ConditionalOnClass(name = "com.mysql.jdbc.Driver")
    public DruidDataSource dataSource() {
        return new DruidDataSource();
    }
}
